A04 - Binary Representation 1
https://atcoder.jp/contests/tessoku-book/tasks/tessoku_book_d
提出
code: python
n = int(input())
while n > 1:
if n % 2 == 1:
n //= 2
解答
code: python
n = int(input())
for x in range(9, -1, -1):
wari = (2 ** x)
print((n // wari) % 2, end='')
print("")
提出
code: python
from collections import deque
n = int(input())
# 0 -> 0
# 1 -> 1
# 2 -> 10
# 3 -> 11
# 4 -> 100
ans = deque()
while n >= 1:
if n % 2 == 0:
ans.appendleft(0)
n //= 2
else:
ans.appendleft(1)
n //= 2
if len(ans) < 10:
for i in range(10-len(ans)):
ans.appendleft(0)
print(''.join(map(str, ans)))